package com.skycode6.dao;

import com.skycode6.util.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    DBConnection DBConn = new DBConnection();

    public boolean checkLogin(String s1, String s2) throws SQLException {
            // conn对象代表数据路链接
            Connection conn = DBConn.getConn();
            Statement stmt = conn.createStatement();
            ResultSet rs = null;
            boolean OK = true;
            String sql = "select * from admin where " +
                    "AdminName = '" + s1 + "' and " +
                    "AdminPwd = '" + s2 + "'";
            rs = stmt.executeQuery(sql);
            if (!rs.next()) {
                OK = false;
            }
            return OK;
        }

    }
